package it.polimi.reTraveldream.entities;


import it.polimi.reTravelDream.dto.FlightDTO;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.*;


/**
 * Entity implementation class for Entity: Flight
 *
 */
@Entity
@Table(name="flights")

@NamedQueries({
	@NamedQuery(name=Flight.FIND_ALL,
            query="SELECT f FROM Flight f")	
})

public class Flight implements Serializable {
	
	private static final long serialVersionUID = 1L;
	public static final String FIND_ALL="Flight.findAll"; 
	   
	@Id
	private int id;
	private String departureCity;
	private String arrivalCity;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date date;
	
	private int price;
	
	private boolean isActive;
	

	public Flight() {
	}
	
	public Flight(FlightDTO flightDTO) {
		super();
		this.id=flightDTO.getId();
		this.departureCity= flightDTO.getDepartureCity();
		this.arrivalCity=flightDTO.getArrivalCity();
		this.date=flightDTO.getData();
		this.price=flightDTO.getPrice();
		this.isActive=flightDTO.isActive();
	} 
	
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}
	public String getDepartureAirport() {
		return departureCity;
	}
	public void setDepartureAirport(String departureAirport) {
		this.departureCity = departureAirport;
	}
	public String getArrivalAirport() {
		return arrivalCity;
	}
	public void setArrivalAirport(String arrivalAirport) {
		this.arrivalCity = arrivalAirport;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public boolean isActive() {
		return isActive;
	}

	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}
   
}
